package it.unisa.unibox.bridge;

import it.unisa.unibox.Storage.DBAutenticazione;
import it.unisa.unibox.Storage.DBGestioneProdotti;
import it.unisa.unibox.commons.DBNames;

public class RefinedAbstractManager extends AbstractManager<IManager> {

	// Singleton Design Pattern's implementation
	private static RefinedAbstractManager refinedManager;

	private RefinedAbstractManager() {
	}

	public static RefinedAbstractManager getInstance() {
		if (refinedManager == null) {
			refinedManager = new RefinedAbstractManager();
		}
		return refinedManager;
	}
	// end of Singleton Design Pattern's implementation

	@Override
	public IManager getManagerImplementor(String pManagerType) {
		
		if(pManagerType.equals(DBNames.TABLE_ACCOUNT))
			this.imp = DBAutenticazione.getInstance();
		
		else if(pManagerType.equals(DBNames.TABLE_PRODOTTO))
			this.imp = DBGestioneProdotti.getInstance();
		
		

		return this.imp;
	}
}
